﻿using server.Model;
using SuperSocket.SocketBase.Command;
using SuperSocket.SocketBase.Protocol;
using System;

namespace server.command
{
    /// <summary>
    /// 更新位置
    /// </summary>
   public class UpdatePosition:CommandBase<PubgSession, StringRequestInfo>
    {
        public override void ExecuteCommand(PubgSession session, StringRequestInfo requestInfo)
        {

            //Console.WriteLine("握手信息");
            SessionItem sessionItem = null;
            PubgSession.mOnLineConnections.TryGetValue(session, out sessionItem);
            if(sessionItem!=null)
            {
                GPSUserItem gpsItem = Utils.CollectionsConvert.ToObject<GPSUserItem>(requestInfo.Body.ToString());
                if(sessionItem.gpsItem!=null)
                {
                    sessionItem.gpsItem.lat = gpsItem.lat;
                    sessionItem.gpsItem.lon = gpsItem.lon;
                    sessionItem.gpsItem.angle = gpsItem.angle;

                }
                //sessionItem.gpsItem = gpsItem;
            }
           // Console.WriteLine("收到客户端位置更新：" + session.RemoteEndPoint);


        }
    }
}
